package com.cute4j.diffs.cuteswing;

import com.cute4j.swing.BoundedRangeModel;
import com.cute4j.swing.DefaultBoundedRangeModel;
import com.cute4j.swing.Frame;
import com.cute4j.swing.ProgressBar;
import com.cute4j.swing.ScrollBar;
import com.cute4j.swing.Slider;
import com.cute4j.swing.Swing;
import com.cute4j.swing.layouts.GridLayout;


/**
 * Model View Controller.
 */
public class MVC {

  public static void main(String[] args) {
    // No EDT stuff <-- DIFF+
    // Everything is done in the GUI thread implicitly
    Frame frame = new Frame("MVC");
    frame.setDefaultCloseOperation(Frame.EXIT_ON_CLOSE);
    GridLayout layout = new GridLayout(3, 1, 8, 8);
    frame.setLayout(layout); // <-- DIFF:
    BoundedRangeModel model =
        new DefaultBoundedRangeModel(50, 0, 0, 100);
    frame.add(new Slider(model)); // <-- DIFF
    frame.add(new ProgressBar(model)); // <-- DIFF
    ScrollBar scrollBar =
        new ScrollBar(ScrollBar.HORIZONTAL);
    scrollBar.setModel(model);
    frame.add(scrollBar); // <-- DIFF
    frame.setBounds(100, 100, 200, 100);
    frame.setVisible(true);
    Swing.startEventLoop(); // <-- DIFF-
  }

}
